/*
	File:	sys/Scripting.hpp
	Date:	2013-06-09
	Author:	Asteroth
*/


#ifndef __ZEN_SCRIPTING__
#define __ZEN_SCRIPTING__

#include <map>
#include <JSL.hpp>

#include "../sys/Settings.hpp"
#include "../sys/Resources.hpp"

extern "C" {
	#include <lua/lua.h>
	#include <lua/lualib.h>
	#include <lua/lauxlib.h>
}

namespace zen {

	namespace sys {


		class Event {

		public:

			Event() {};
			virtual ~Event() {};

			// push event parameters to lua state using for example lua_pushnumber
			virtual void pushState(lua_State* state) = 0;

		};

		class Scripting {

		public:

			static bool initialize();

			static void call(const std::string& functionName, Event* event);

			static bool loadModule(const std::string& moduleName);
			

		private:

			static bool initialized;
			static std::map<std::string, std::string> scriptFiles;
			static lua_State* luaState;

		};


	} // namepace sys

} // namepace zen

#endif // __ZEN_SCRIPTING__
